What is @ledgerhq/devices?
@ledgerhq/devices is an npm package that provides a comprehensive set of tools and utilities for interacting with Ledger hardware wallets. It includes functionalities for managing device information, handling firmware updates, and interfacing with various Ledger applications.
What are @ledgerhq/devices's main functionalities?
List Supported Devices
This feature allows you to retrieve information about a specific Ledger device model. In this example, the code fetches details about the Ledger Nano S model.
const { getDeviceModel } = require('@ledgerhq/devices');
const deviceModel = getDeviceModel('nanoS');
console.log(deviceModel);
Identify Device by USB Product ID
This feature helps you identify a Ledger device based on its USB product ID. The code sample demonstrates how to get device information using a specific USB product ID.
const { identifyUSBProductId } = require('@ledgerhq/devices');
const deviceInfo = identifyUSBProductId(0x0001);
console.log(deviceInfo);
List All Devices
This feature provides a list of all supported Ledger devices. The code sample prints out the entire list of devices supported by the @ledgerhq/devices package.
const { devices } = require('@ledgerhq/devices');
console.log(devices);
0
@ledgerhq/devices
Logic for all Ledger devices.
API
Table of Contents
createHIDframing
Parameters
IIGenericHID
The USB product IDs will be defined as MMII, encoding a model (MM) and an interface bitfield (II)
Type: number
ledgerUSBVendorId
Type: number
getDeviceModel
Parameters
Returns DeviceModel
identifyUSBProductId
Parameters
Returns DeviceModel?
getBluetoothServiceUuids
getInfosForServiceUuid
Parameters
Returns BluetoothInfos?
DeviceModelId
Type: $Keys<any>
DeviceModel
Type: {id: DeviceModelId, productName: string, productIdMM: number, legacyUsbProductId: number, usbOnly: boolean, memorySize: number, blockSize: number, bluetoothSpec: Array<{serviceUuid: string, writeUuid: string, notifyUuid: string}>?}
Properties
BluetoothInfos
Type: {deviceModel: DeviceModel, serviceUuid: string, writeUuid: string, notifyUuid: string}
Properties
Type: {id: DeviceModelId, productName: string, usbProductId: number, bluetoothSpec: Array<{serviceUuid: string, writeUuid: string, notifyUuid: string}>?}
Type: {id: string, productName: string, usbProductId: number, usbOnly: boolean, bluetoothSpec: Array<{serviceUuid: string, writeUuid: string, notifyUuid: string}>?}
master
Properties
BluetoothInfos
Type: {deviceModel: DeviceModel, serviceUuid: string, writeUuid: string, notifyUuid: string}
Properties